﻿package com.kuanter.kuanterauto.adapter;

import java.util.List;

import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.kuanter.kuanterauto.R;
import com.kuanter.kuanterauto.entity.CardInfo;

public class CardInfoListAdapter extends BaseAdapter {
	private List<CardInfo> cardInfoList ;
	private Activity activity ;
	private TextView tv_card_number_title;
	private TextView tv_card_number;
	private TextView tv_card_insurance_company;

	public CardInfoListAdapter(List<CardInfo> cardInfoList,
			Activity activity) {
		this.cardInfoList = cardInfoList;
		this.activity = activity;
		
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return cardInfoList.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return cardInfoList.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View view = null ;
		if(null == convertView){
			view = view.inflate(activity, R.layout.my_kuanter_card_list_item, null);
		}else {
			view = convertView;
		}
		tv_card_number_title = (TextView)view.findViewById(R.id.tv_include_3_tv_arrow_title);
		tv_card_number_title.setText("卡号：");
		tv_card_number = (TextView)view.findViewById(R.id.tv_include_3_tv_arrow_data1);
		tv_card_number.setText(cardInfoList.get(position).getCardNumber());
		tv_card_insurance_company = (TextView)view.findViewById(R.id.tv_include_3_tv_arrow_data2);
		//tv_card_insurance_company.setText(cardInfoList.get(position).getAccountInfo().getCustomerGroupName());
		return view;
	}

}
